#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H

#if !defined(__CL_ENABLE_EXCEPTIONS)
#define __CL_ENABLE_EXCEPTIONS
#endif

#include "../cl/cl.hpp"
#include <QMainWindow>
#include <vector>

class QObject;
class QEvent;
class QToolBar;
class QComboBox;
class QLabel;

namespace ui {

    class CLMarkWidget;

    /** @brief The MainWindow class. */
    class MainWindow : public QMainWindow {

        Q_OBJECT

    public:

        /** @brief MainWindow of the clMark application.
         * @param parent */
        MainWindow(QWidget *parent = 0);
        ~MainWindow();

    private slots:
        void onPlatformChanged(int index);
        void onDeviceChanged(int index);
        void onIsLocked(bool result);
        bool eventFilter(QObject *watched, QEvent *event);

    private:
        void setupUi(void);
        void setupCl(void);
        void loadPlatforms(void);
        void loadDevices(cl::Platform &platform);

        QToolBar     *toolBar;
        QComboBox    *comboBoxPlatforms;
        QComboBox    *comboBoxDevices;
        CLMarkWidget *clMarkWidget;
        QLabel       *labelStatus;
        std::vector<cl::Platform> platforms;
        std::vector<cl::Device>   devices;
        int platformIndex;
        int deviceIndex;
        bool isLocked;
    };
}

#endif // UI_MAINWINDOW_H
